<?php
class database
{
    static function connect()
    {
        require('configu.php');
        $conn=mysql_connect($CFG->mysqlhost,$CFG->mysqluser,$CFG->mysqlpass);
        if(!$conn)
        {
            die('MYSQL. Could not connect: ' . mysql_error());
        }
        $CFG->mysqlconn=$conn;
        return $conn;
    }

    static function query($query)
    {
        require('configu.php');
        $conn=database::connect();
        mysql_select_db($CFG->mysqldb,$conn);
        $res=mysql_query($query);
        mysql_close();
        return $res;
    }
}
?>
